<?php 
class HangyeModel extends BaseModel {
	public function add_hangye($data) {
		$result = $this->add($data);
		if($result){
			return true;
		}else{
			return false;
		}
		
	}
	public function select_hangye(){
		$result = $this->where(array('is_del'=>0))->select();
		return $result;

	}
	public function get_hangye($id) {
		$result = $this->where(array('id'=>$id))->find();
		return $result;
		
	}

	public function edit_hangye($id,$data) {
		$result = $this->where(array('id'=>$id))->save($data);
		
		if($result){
			return true;
		}else{
			return false;
		}
		
	}

	public function del_hangye($id){
		$data['is_del']=1;
		$da = $this->where(array('id'=>$id))->save($data);
		$va = D('position')->where(array('hid'=>$id))->save($data);
		if($da && $va){
			return true;
		}else{
			return false;
		}
	}
	
}
?>